
import { Component, OnInit } from 'angular2/core';

@Component({
    selector: 'weui-progress',
    templateUrl: './app/component/progress/progress.html'
})

export class ProgressComponent implements OnInit {

    private _progress = 0;
    private _uploading = false;

    private _width1 = "0%";
    private _width2 = "50%";
    private _width3 = "80%";

    constructor() { }

    ngOnInit() { }

    upload(event) {

        if (!this._uploading) {
            this._uploading = !this._uploading;
            this.next();
        }

    }

    next() {
        this._progress = ++this._progress % 100;

        this._width1 = this._progress+"%";
        this._width2 = this._progress+"%";
        this._width3 = this._progress+"%";
        
        setTimeout(()=>this.next(), 30);

    }

}